<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { Reading, Document } from '@element-plus/icons-vue'

const router = useRouter()
const activeMenu = ref('learning')

const handleMenuSelect = (key) => {
  switch (key) {
    case 'learning':
      router.push('/knowledge/learning')
      break
    case 'sop':
      router.push('/knowledge/sop')
      break
  }
}
</script>

<template>
  <div class="manager-container">
    <!-- 左侧菜单 -->
    <div class="sidebar">
      <el-menu
        :default-active="activeMenu"
        class="sidebar-menu"
        @select="handleMenuSelect"
      >
        <el-menu-item index="learning">
          <el-icon><Reading /></el-icon>
          <span>学习天地</span>
        </el-menu-item>
        <el-menu-item index="sop">
          <el-icon><Document /></el-icon>
          <span>文档SOP</span>
        </el-menu-item>
      </el-menu>
    </div>

    <!-- 右侧内容区 -->
    <div class="content">
      <router-view></router-view>
    </div>
  </div>
</template>

<style scoped>
.manager-container {
  display: flex;
  height: calc(100vh - 60px);
  background-color: #fff;
}

.sidebar {
  width: 200px;
  border-right: 1px solid #e6e6e6;
  background-color: #fff;
}

.sidebar-menu {
  border-right: none;
}

.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: #f5f7fa;
}

:deep(.el-menu-item) {
  display: flex;
  align-items: center;
  padding-left: 20px !important;
}

:deep(.el-menu-item .el-icon) {
  margin-right: 8px;
}
</style> 